//
//  InterventoTapViewController.m
//  InterventixApp
//
//  Created by Diego on 29/12/12.
//  Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//

#import "InterventoTapViewController.h"

@implementation InterventoTapViewController

@synthesize data,ora,tipologia,prodotto,motivo,nominativo,scroll;

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)didReceiveMemoryWarning
{
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
    
    // Release any cached data, images, etc that aren't in use.
}

#pragma mark - View lifecycle

/*
// Implement loadView to create a view hierarchy programmatically, without using a nib.
- (void)loadView
{
}
*/


// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad
{
    [super viewDidLoad];
    self.data.delegate = self;
    self.ora.delegate = self;
    self.tipologia.delegate = self;
    self.prodotto.delegate = self;
    self.motivo.delegate = self;
    self.nominativo.delegate = self;
}

- (BOOL)textFieldShouldReturn:(UITextField *)textField {
    //if (textField == self.data) {
        [textField resignFirstResponder];
    //}
    [self.scroll setContentOffset:CGPointMake(0,0) animated:YES];
    return NO;
}

- (void)textFieldDidBeginEditing:(UITextField *)textField{
    [self.scroll setContentOffset:CGPointMake(0,100) animated:YES];
}

- (void)viewDidAppear:(BOOL)animated{
    
    self.data.delegate = self;
    self.ora.delegate = self;
    
    
    NSString *dateString = [NSDateFormatter localizedStringFromDate:[NSDate date]
                                                      dateStyle:NSDateFormatterShortStyle
                                                      timeStyle:NSDateFormatterNoStyle];
    
    NSString *oraString = [NSDateFormatter localizedStringFromDate:[NSDate date]
                                                          dateStyle:NSDateFormatterNoStyle
                                                          timeStyle:NSDateFormatterShortStyle];
    
    self.data.text = dateString;
    self.ora.text = oraString;
}
- (void)viewDidUnload
{
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}



-(IBAction) indietro{
	[[self navigationController] popViewControllerAnimated:YES];
}


@end
